package net.eicp.jxcontent.doc.snippet

import net.eicp.jxcontent.core.snippet.JXDispatchSnippet
import net.liftweb.common._
import net.liftweb.http._
import net.liftweb.http.S._
import net.liftweb.util._
import net.liftweb.util.Helpers._
import net.liftweb.mapper._
import scala.xml._
import net.eicp.jxcontent.core.snippet.JXSnippetScope

class ListRender1 extends JXDispatchSnippet {
  override def dispatch = {case "render1" => render1 _}
  
  def render1(scope: JXSnippetScope) = {
      10 =>> { () =>
        scope.saveOrUpdate({
          case ("JXTest", a: List[Int] @unchecked) => ("JXTest", a ::: List(4, 5, 6))
        })("JXTest", List(4, 5, 6))
      } &
      5 === { xhtml =>
        ("#ad -*" #> scope.getVal{case ("JXTest", a: List[Int] @unchecked) => a}
          .openOrThrowException("没有数据").mkString)
          .apply(xhtml)
      }
  }
}